//#include<iostream>
//#include<iomanip>
//#include<limits.h>
//using namespace std;
//void quickSort(int t[10001], int w[10001], double hw[10001], int low, int high) {
//	if (low < high) {
//		double base_t = t[low], base_w = w[low], base_hw = hw[low];
//		int left = low, right = high;
//		while (left < right) {
//			while (left < right && t[right] >= base_t)
//				right--;
//			if (left < right) {
//				t[left] = t[right];
//				w[left] = w[right];
//				hw[left] = hw[right];
//			}
//			while (left < right && t[left] <= base_t)
//				left++;
//			if (left < right) {
//				t[right] = t[left];
//				w[right] = w[left];
//				hw[right] = hw[left];
//			}
//		}
//		t[left] = base_t;
//		w[left] = base_w;
//		hw[left] = base_hw;
//		quickSort(t, w, hw, low, left - 1);
//		quickSort(t, w, hw, left + 1, high);
//	}
//}
//int main() {
//	int n, m, t[10001]{ 0 }, w[10001]{ 0 };
//	double wage_per_hour[10001]{ 0.0 };
//	cin >> n >> m;
//	for (int i = 1; i <= n; i++)
//		cin >> t[i];
//	for (int i = 1; i <= n; i++)
//		cin >> w[i];
//	for (int i = 1; i <= n; i++)
//		wage_per_hour[i] = (double)w[i] / (double)t[i];
//	/*
//	*min(max(w1 / h1, w2 / h2, ...) * (h1 + h2 + ...))==
//	*min(max_perhour_wage.w + max_perhpur_wage * (sum_h - max_perhour_wage.h))
//	*F[i]: max_perhour_wage.w = wage_per_hour[i], min(sum_h)
//	*/
//	double F[10001]{ 0.0 }, min_total_wage = INT_MAX;
//	int num_m = 0;
//	quickSort(t, w, wage_per_hour, 1, n);
//	//for (int i = 1; i <= n; i++)
//	//	cout << "t=" << t[i] << ",w=" << w[i] << ",hw=" << wage_per_hour[i] << endl;
//	for (int i = 1; i <= n; i++) {
//		F[i] = w[i];
//		num_m = 1;
//		for (int j = 1; j <= n; j++) {
//			if (num_m == m)
//				break;
//			else
//				if (j != i && wage_per_hour[j] <= wage_per_hour[i]) {
//					F[i] += t[j] * wage_per_hour[i];
//					num_m += 1;
//				}
//		}
//		if (num_m == m)
//			min_total_wage = min(min_total_wage, F[i]);
//		//cout << "F[" << i << "]=" << F[i] << endl;
//	}
//	cout << fixed << setprecision(5) << min_total_wage << endl;
//	return 0;
//}